package com.css.bjdt_report.executive.entity;

import com.css.bjdt_report.report.entity.RptTemplateCalc;
import com.css.bjdt_report.report.entity.RptTemplateCalc.CalcType;
import com.css.bjdt_report.report.entity.RptTemplateValidation;
import com.css.bjdt_report.report.entity.RptTemplateValidation.ValidationType;

import lombok.Data;
/**
 * 
 * @author qiushi
 *
 */
@Data
public class Exp {
	//表达式
	private String formula;
	//表达式前台展示
	private String formulaShow;
	//单元格表达式
	private String cellExp;
	//表达式类型
	private String formulaType;
	//排序
	private Integer order;
	
	public Exp(){
	}
	
	public Exp(RptTemplateCalc calc){
		formula = calc.getCalcFormula();
		formulaShow = calc.getCalcFormulaShow();
		formulaType = calc.getCalcType();
		order = calc.getOrderId();
		if(CalcType.cell.getKey().equals(formulaType)){
			cellExp = calc.getCalcFormula();
		}
	}
	
	public Exp(RptTemplateValidation validation){
		formula = validation.getValidationFormula();
		formulaShow = validation.getValidationFormulaShow();
		formulaType = validation.getValidationType();
		if(ValidationType.inner_cell.getKey().equals(formulaType) || ValidationType.outer_cell.getKey().equals(formulaType)){
			cellExp = validation.getValidationFormula();
		}
	}
}
